﻿using Grow.Module.AspNetCore.Service;
using Grow.Module.Service;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;

namespace Grow.AspNetCore.Service
{
    public class ApplicationServiceContext : ServiceContext, IApplicationServiceContext
    {
        public ApplicationServiceContext(IServiceProvider serviceProvider, IServiceScopeFactory serviceScopeFactory) : base(serviceProvider, serviceScopeFactory)
        {
        }

        public IApplicationBuilder GetApplicationBuilder()
        {
            return GetRequiredService<IServiceManager>()
                .GetRequiredService<IApplicationBuilder>();
        }

        public IEndpointRouteBuilder GetEndpointRouteBuilder()
        {
            return GetRequiredService<IServiceManager>()
                .GetRequiredService<IEndpointRouteBuilder>();
        }


    }
}
